home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / Kubuntu 8.10 / kubuntu-8.10-desktop-i386.iso / casper / filesystem.squashfs / etc / acpi / hibernate.sh < prev    next >
Linux/UNIX/POSIX Shell Script  |  2008-10-14  |  1KB  |  48 lines

  1. #!/bin/bash
  2. # TODO:  Above should be /bin/sh
  3.  
  4. test -f /usr/share/acpi-support/state-funcs || exit 0
  5.  
  6. . /etc/default/acpi-support
  7. . /usr/share/acpi-support/power-funcs
  8. . /usr/share/acpi-support/policy-funcs
  9.  
  10. if [ x$ACPI_HIBERNATE != xtrue ] && [ x$1 != xforce ]; then
  11.   exit;
  12. fi
  13.  
  14. # Unset video posting - it's not needed for suspend to disk
  15. unset POST_VIDEO
  16. unset USE_DPMS
  17.  
  18. . /etc/acpi/prepare.sh
  19.  
  20. #if [ x$LOCK_SCREEN = xtrue ]; then
  21. #    for x in /tmp/.X11-unix/*; do
  22. #    displaynum=`echo $x | sed s#/tmp/.X11-unix/X##`
  23. #    getXuser;
  24. #    if [ x"$XAUTHORITY" != x"" ]; then
  25. #        export DISPLAY=":$displaynum"
  26. #        . /usr/share/acpi-support/screenblank
  27. #    fi
  28. #    done
  29. #fi
  30.  
  31. echo -n $HIBERNATE_MODE >/sys/power/disk
  32.  
  33. if [ -x /sbin/s2disk ]; then
  34.     DEVICE="/dev/disk/by-uuid/`awk -F= '{print $3}' </etc/initramfs-tools/conf.d/resume`"
  35.     if [ -f /etc/usplash.conf ]; then
  36.     . /etc/usplash.conf
  37.     /sbin/s2disk -x "$xres" -y "$yres" $DEVICE
  38.     else
  39.     /sbin/s2disk $DEVICE
  40.     fi
  41. else
  42.     echo -n "disk" >/sys/power/state
  43. fi
  44.  
  45. $LAPTOP_MODE stop
  46.  
  47. . /etc/acpi/resume.sh
  48.